package com.king.im.handler;

import com.king.common.lang.Consts;
import com.king.im.handler.impl.ChatMsgHanlder;
import com.king.im.handler.impl.PingMsgHandler;

import java.util.HashMap;
import java.util.Map;

public class IMMsgHandlerFactory {
    private static Map<String, IMMsgHanlder> handlerMap = new HashMap<>();

    public static void init() {
        handlerMap.put(Consts.IM_MESS_TYPE_CHAT, new ChatMsgHanlder());
        handlerMap.put(Consts.IM_MESS_TYPE_PING, new PingMsgHandler());
    }

    public static IMMsgHanlder getMsgHandler(String type) {
        return handlerMap.get(type);
    }
}
